package com.mengdee.manage.controller;

import org.springframework.validation.FieldError;

import com.alibaba.fastjson.JSONObject;

public class BaseController {

	public JSONObject ResponseJsonError(FieldError fieldError) {
		String message = fieldError.getDefaultMessage();
		JSONObject response = new JSONObject();
		
		if (message != null) {
			response.put("result", "error");
			response.put("field", fieldError.getField());
			response.put("msg", message);
		} 
		return response;
	}
}
